﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>
/// Descripción breve de DropDownListTextFiller
/// </summary>
public static class DropDownListTextFiller
{
    public const string NullTextValue = "- -"; 
    public static void FillDropDownList(DropDownList lista,string nullValue,int iniValue,int endValue )
    {
        lista.Items.Add(nullValue);
        for (int i = iniValue; i <= endValue; i++)         
            lista.Items.Add(i.ToString());
    }
    public static void FillDropDownList(DropDownList lista,  int iniValue, int endValue,int DefaultValue)
    {

        int index = -1;
        
        for (int i = iniValue; i <= endValue; i++)
        {
            lista.Items.Add(i.ToString());
            if (i == DefaultValue)
            {
                index=lista.Items.Count - 1;

            }
        }
        lista.SelectedIndex = index;
       
    }
    
}
